﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace StoreWeb.system.basis
{
    public partial class Inventorypriceeditt : System.Web.UI.Page
    {
        Maticsoft.BLL.InventoryClass blls = new Maticsoft.BLL.InventoryClass();
        Maticsoft.BLL.Dictionary dbll = new Maticsoft.BLL.Dictionary();
        Maticsoft.BLL.Inventory bll = new Maticsoft.BLL.Inventory();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hidid.Value = Request["id"];
                if (!string.IsNullOrEmpty(hidid.Value))
                {
                    this.parentlist.DataSource = dbll.GetList("parentcode='PO_POCLASS'");
                    this.parentlist.DataTextField = "name";
                    this.parentlist.DataValueField = "code";
                    this.parentlist.DataBind();
                    this.parentlist.Items.Insert(0, new ListItem("--请选择采购分类--", ""));
                    Maticsoft.Model.Inventory md = bll.GetModel(Convert.ToInt32(hidid.Value));
                    foreach (ListItem item in rdobtnbuy.Items)
                    {
                        if (item.Value == md.buyvalue)
                        {
                            item.Selected = true;
                        }
                    }
                    parentlist.SelectedValue = md.dictionarycode;
                    //获取分类价格
                    price.Value = blls.GetModelList("cInvCCode=" + md.cInvCCode)[0].price;
                    cInvCode.Value = md.cInvCode;
                    cInvAddCode.Value = md.cInvAddCode;
                    cInvName.Value = md.cInvName;
                    cInvStd.Value = md.cInvStd;
                    iInvWeight.Value = md.iInvWeight.ToString();
                    iVolume.Value = md.iVolume.ToString();
                    //iInvSPrice.Value = md.iInvSPrice.ToString();
                    //iInvSCost.Value = md.iInvSCost.ToString();
                    //iInvLSCost.Value = md.iInvLSCost.ToString();
                    //iInvNCost.Value = md.iInvNCost.ToString();
                }
            }
        }
    }
}